<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">
<head>
<title>How to create a plugin</title>
<link href="css/help.css" rel="stylesheet" type="text/css" />
<meta name="copyright" content="Copyright (C) 2008 Bernard Gilly. All rights reserved." />
<meta name="license" content="http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL" />
<style type="text/css">
<!--
.Style1 {
	font-size: 14pt;
	font-weight: bold;
}
.Style5 {color: #FF0000}
.Style6 {color: #000000}
-->
</style>
</head>
<body>
<h1>AlphaUserPoints - How create a plugin - (Basic) </h1>

<p> The creation of a plugin (creation of a new rule for a third component) is divided into 2 phases. 
    <br />
    <br />
    <span class="Style1">Step 1 - Inserting  API in the component </span><br />
This course is aimed primarily at developers or any person with a level of knowledge sufficiently advanced in PHP. <br />
<br />
Simply insert the following API in the code component to where you want. The ideal is to follow an action that can bring items to the connected user. For example, in a component of any comments or forum, simply add the API after insertion source code of the commentary or new topic in the database. <br />
<br />
<strong>API:</strong> </p>
<p class="Style5">$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';<br />
  if ( file_exists($api_AUP))<br />
  {<br />
&nbsp;&nbsp;&nbsp;&nbsp;require_once ($api_AUP);<br />
&nbsp;&nbsp;&nbsp;&nbsp;AlphaUserPointsHelper::newpoints( 'function_name' );<br />
  }</p>
<p><br />
  <b>function_name</b> is the rule which will be used to award points to the current user (if registered and logged). <br />
For all the rules included in AlphaUserPoints (systems), the function names are written as follows: <br />
<br />
example: <i>sysplgaup_newregistered</i> for awarding points to a new registered user. <br />
<br />
It should keep a nomage standard for plugin-third of components as follows: <br />
<br />
<i>plgaup_function_name<br />
</i><br />
Example <i>plgaup_newcomment</i> or <i>plgaup_newtopic</i> to resume the example of the inclusion of this component API in a comment or forum. <br />
The name of a function to award points when creating a new topic posted in the component Fireboard could be, for example, <i>plgaup_newtopic_fb</i>. <br />
<br />
<span class="Style1">Step 2 - Creation  XML file</span><br />
It should then create a file xml to facilitate the installation of the rule in AlphaUserPoints. <br />
5 elements need to be specified: <br />
<br />
The name of the rule, its description, the name of the component using the rule (com_example), the function name used by the rule and if points are fixed (true or false). <br />
<br />
&lt;? xml version = "1.0" encoding = "utf-8"?&gt; <br />
&lt;alphauserpoints type="plugin"&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp; &lt;rule&gt;<span class="Style5">short name of the rule</span>&lt;/ rule&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp; &lt;description&gt;<span class="Style5">Description of the rule</span>&lt;/ description&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp; &lt;component&gt;<span class="Style5">com_example_component (or Exemple component)</span>&lt;/ component&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp; &lt;plugin_function&gt;<span class="Style5">plgaup_function_name</span>&lt;/ plugin_function&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;fixed_points&gt;<span class="Style5">true <span class="Style6">or</span> false</span>&lt;/fixed_points&gt;<br />
&lt;/ alphauserpoints&gt;<br />
  <br />
  This XML file must be encoded in UTF-8 and then can  be archived (. Zip). <br />
  <br />
  <span class="Style1">Note to developers </span><br />
  <br />
You can find the complete documentation to insert and use this API in your components on official website author <a href="http://www.alphaplug.com">www.alphaplug.com</a>.</p>
<p>&nbsp;</p>
</body>
</html>
